package cn.sourcespro.spring.service.impl;

import cn.sourcespro.spring.dao.MenuMapper;
import cn.sourcespro.spring.dao.MenuRoleMapper;
import cn.sourcespro.spring.entity.Menu;
import cn.sourcespro.spring.entity.SysAuthorize;
import cn.sourcespro.spring.service.SysAuthorizeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * security
 *
 * @author zhanghaowei
 * @date 2018/7/27
 */
@Service
public class SysAuthorizeServiceImpl implements SysAuthorizeService {

    @Autowired
    private MenuMapper menuMapper;

    @Override
    public List<SysAuthorize> findAll() {
        List<Menu> list = menuMapper.findAllWithRole();
        return list.stream().map(SysAuthorize::new).collect(Collectors.toList());
    }

}
